import storage from "./storage";
const imageUrl = "http://cdn.wanmofang.top/basic/";
const bufferIndex_C = 1;//角缓冲块位置
const bufferIndex_E = 2;//棱缓冲块位置
const cornerIsKeep = true;
const edgeIsKeep = true;
const cornerLend = [0,1,2,3,5,4,7,6];//角借位顺序
const edgeLend = [1,3,0,2,7,9,11,5,15,16,13,14];//棱借位顺序
const cornerS = ["GHI","JKL","ABC","DEF","RST","XYZ","WMN","OPQ"];//默认编码
const edgeS = ["EF","GH","AB","CD","UU",
				"YZ","RR","QR","FF","ST","LL","WX","BB",
				"MN","OP","IJ","KL","DD"];
const coordinate = 0;//坐标，默认黄顶红前
const yellow = "#FFFF33";
const red = "#FF0000";
const white = "#FFFFFF";
const blue = "#0000FF";
const green = "#00FF33";
const orange = "#FF9900";
const coordinateRange= [
				        { value: 0, text: "黄顶红前" },
				        { value: 1, text: "黄顶蓝前" },
						{ value: 2, text: "黄顶橙前" },
						{ value: 3, text: "黄顶绿前" },
						{ value: 4, text: "白顶绿前" },
						{ value: 5, text: "白顶橙前" },
						{ value: 6, text: "白顶蓝前" },
						{ value: 7, text: "白顶红前" },
						{ value: 8, text: "绿顶红前" },
						{ value: 9, text: "绿顶黄前" },
						{ value: 10, text: "绿顶橙前" },
						{ value: 11, text: "绿顶白前" },
						{ value: 12, text: "蓝顶红前" },
						{ value: 13, text: "蓝顶白前" },
						{ value: 14, text: "蓝顶橙前" },
						{ value: 15, text: "蓝顶黄前" },
						{ value: 16, text: "红顶绿前" },
						{ value: 17, text: "红顶白前" },
						{ value: 18, text: "红顶蓝前" },
						{ value: 19, text: "红顶黄前" },
						{ value: 20, text: "橙顶黄前" },
						{ value: 21, text: "橙顶蓝前" },
						{ value: 22, text: "橙顶白前" },
						{ value: 23, text: "橙顶绿前" },
				      ];
	
const getImageUrl = function(){
	return imageUrl;
}
const getCoordinateRange =function(){
	return coordinateRange;
}
const getBufferIndex_C = function(){
	var res = storage.getStorageWithDefault('bufferIndex_C',bufferIndex_C);
	return res;
}
const getBufferIndex_E = function(){
	var res = storage.getStorageWithDefault('bufferIndex_E',bufferIndex_E);
	return res;
}
const getCornerIsKeep = function(){
	var res = storage.getStorageWithDefault('cornerIsKeep',cornerIsKeep);
	return res;
}
const getEdgeIsKeep = function(){
	var res = storage.getStorageWithDefault('edgeIsKeep',edgeIsKeep);
	return res;
}
const getCornerLend = function(){
	var res = storage.getStorageWithDefault('cornerLend',cornerLend);
	return res;
}
const getEdgeLend = function(){
	var res = storage.getStorageWithDefault('edgeLend',edgeLend);
	return res;
}
const getCornerS = function(){
	var res = storage.getStorageWithDefault('cornerS',cornerS);
	return res;
}
const getEdgeS = function(){
	var res = storage.getStorageWithDefault('edgeS',edgeS);
	return res;
}
const getCornerLendShow = function(cornerLend){
	var res = [];
	for(var i = 0;i<cornerLend.length;i++){
		var offset = cornerLend[i];
		var item;
		switch(offset){
			case 0:
				item = { value: 0, text: "UBR---",color:'#E5716A'};
				break;
			case 1:
				item = { value: 1, text: "UFR---",color:'#D3D240'};
				break;
			case 2:
				item = { value: 2, text: "UFL---",color:'#89CB5B'};
				break;
			case 3:
				item = { value: 3, text: "UBL---",color:'#78DCAE'};
				break;
			case 4:
				item = { value: 4, text: "DBR---",color:'#6EABE7'};
				break;
			case 5:
				item = { value: 5, text: "DFR---",color:'#963711'};
				break;
			case 6:
				item = { value: 6, text: "DFL---",color:'#604447'};
				break;
			case 7:
				item = { value: 7, text: "DBL---",color:'#8C7DE5'};
				break;
		}
		res.push(item);
	}
	return res;
}
const getEdgeLendShow = function(edgeLend){
	var res = [];
	for(var i = 0;i<edgeLend.length;i++){
		var offset = edgeLend[i];
		var item;
		switch(offset){
			case 0:
				item = { value: 0, text: "UB---",color:'#E5716A'};
				break;
			case 1:
				item = { value: 1, text: "UR---",color:'#D3D240'};
				break;
			case 2:
				item = { value: 2, text: "UF---",color:'#89CB5B'};
				break;
			case 3:
				item = { value: 3, text: "UL---",color:'#78DCAE'};
				break;
			case 5:
				item = { value: 5, text: "BR---",color:'#6EABE7'};
				break;
			case 7:
				item = { value: 7, text: "FR---",color:'#963711'};
				break;
			case 9:
				item = { value: 9, text: "FL---",color:'#604447'};
				break;
			case 11:
				item = { value: 11, text: "BL---",color:'#81BCFE'};
				break;
			case 13:
				item = { value: 13, text: "DB---",color:'#1485EE'};
				break;
			case 14:
				item = { value: 14, text: "DR---",color:'#8C7DE5'};
				break;
			case 15:
				item = { value: 15, text: "DF---",color:'#F3C936'};
				break;
			case 16:
				item = { value: 16, text: "DL---",color:'#8C7DE5'};
				break;
		}
		res.push(item);
	}
	return res;
}

const getCoordinate = function(){
	var res = storage.getStorageWithDefault('coordinate',coordinate);
	return res;
}

const getYellow = function(){
	return yellow;
}
const getRed = function(){
	return red;
}
const getWhite = function(){
	return white;
}
const getBlue = function(){
	return blue;
}
const getGreen = function(){
	return green;
}
const getOrange = function(){
	return orange;
}
export default{
	getImageUrl,getBufferIndex_C,getBufferIndex_E,
	getCornerIsKeep,getEdgeIsKeep,getCornerLend,getEdgeLend,
	getCornerS,getEdgeS,getEdgeLendShow,getCornerLendShow,
	getCoordinate,getCoordinateRange,
	getYellow,getRed,getWhite,getBlue,getGreen,getOrange
}